package com.itheima.d1_collection_set;

import com.itheima.d1_collection_set.bean.Student;

import java.util.TreeSet;

/**
 * 目标：掌握TreeSet集合的使用。
 */
public class SetTest4 {
    public static void main(String[] args) {//根据比较规则的返回值是否等于0去重复
        TreeSet<Student> tree = new TreeSet<>((s1,s2)->Double.compare(s1.getAge(), s2.getAge()));
        tree.add(new Student("小兮",22,165));
        tree.add(new Student("小兮",20,160));
        tree.add(new Student("小兮",25,170));
        tree.add(new Student("小兮",20,160));
        tree.add(new Student("小兮",20,160));

        System.out.println(tree);


    }
}
